import http from '@/utils/http/axios';


//获取所有角色
export function fetchRoleTree() {
    return http.request({
        url: '/system/role/fetchRoleTree',
        method: 'get',
    })
}

//根据角色ID获取用户账号列表分页
export function fetchUserListPageByRoleId(params) {
    return http.request({
        url: `/system/user/fetchUserListPageByRoleId`,
        method: 'get',
        params
    })
}

//新增角色组
export function addRoleGroup(params) {
    return http.request({
        url: '/system/role/addRoleGroup',
        method: 'post',
        params
    })
}

//新增角色
export function addRole(params) {
    return http.request({
        url: '/system/role/addRole',
        method: 'post',
        params
    })
}

//删除角色组
export function deleteRoleGroup(params) {
    return http.request({
        url: `/system/role/deleteRoleGroup/${params}`,
        method: 'delete',
    })
}

//删除角色
export function deleteRole(params) {
    return http.request({
        url: `/system/role/deleteRole/${params}`,
        method: 'delete',
    })
}


//解除用户和角色绑定
export function deleteUserRole(params) {
    return http.request({
        url: `/system/role/deleteUserRole`,
        method: 'delete',
        params
    })
}

//查看角色绑定的权限(外面单独)
export function fetchAuthListByRoleId(params) {
    return http.request({
        url: `/system/role/fetchAuthListByRoleId/${params}`,
        method: 'get',
    })
}

//查看角色绑定的菜单(外面单独)
export function fetchMenuListByRoleId(params) {
    return http.request({
        url: `/system/role/fetchMenuListByRoleId/${params}`,
        method: 'get',
    })
}

//获取权限列表
export function fetchAuthListPage(params) {
    return http.request({
        url: `/system/auth/fetchAuthListPage`,
        method: 'get',
        params
    })
}

//获取菜单列表
export function fetchMenuList(params) {
    return http.request({
        url: `/system/menu/fetchMenuList`,
        method: 'get',
        params
    })
}

//更新角色组
export function updateRoleGroup(params) {
    return http.request({
        url: `/system/role/updateRoleGroup`,
        method: 'put',
        params
    })
}